#ifndef __MAP_PUBLISH_H__
#define __MAP_PUBLISH_H__

#include <ros/ros.h>
#include <nav_msgs/OccupancyGrid.h>
#include <iostream>

using namespace std;

class MapPublish {
    public:
        MapPublish(string topic_name){
            map_pub_ = nh_.advertise<nav_msgs::OccupancyGrid>(topic_name, 1, true);
        }
        ~MapPublish() = default;

        // 发布地图数据
        void publishMap(nav_msgs::OccupancyGrid& map){
            map_pub_.publish(map);
        }

    private:
        ros::NodeHandle nh_;
        ros::Publisher map_pub_;

};

#endif